﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace stockfund.src
{
    class GLOBAL_DATA
    {
        public static List<Stock> STOCKS = new List<Stock>();
        public static List<OkZcgg> OKZCGG = new List<OkZcgg>();
        public static string MODEL_NAMESPACE = "stockfund.src.";
        public static string[] STOCKSLIST_TABLES = new string[] { "stockzcgg", "stockinrank" };
        public static string[] HANGTETYPE = new string[] {"行业资金净流出排行(标准行业一级)",
                                                     "行业资金净流入排行(标准行业一级)",
                                                     "行业净流出占成交排行(标准行业一级)",
                                                     "行业净流入占成交排行(标准行业一级)",
                                                     "行业机构减仓排行(标准行业一级)",
                                                     "行业机构增仓排行(标准行业一级)" };
        public static string HANGYEURL = "http://vol.stock.hexun.com/Now/Industry/IduFlow.ashx?idutype=1&ranktype=";
        public static string STOCKINRANKURL = "http://vol.stock.hexun.com/Now/Share/StockFlow.ashx?idutype=0&ranktype=$pos&iducode=ALL";
        public static string[] STOCKINRANKTYPE = new string[]{
                                                    "个股资金净流出排行",
                                                    "个股资金净流入排行",
                                                    "个股净流出占成交排行",
                                                    "个股净流入占成交排行",
                                                    "个股机构减仓排行",
                                                    "个股机构增仓排行"
                                                    };
        public static string[] STOCKZCGGTYPE = new string[]{"个股连续机构增仓个股","个股连续机构减仓个股"};
        public static string[] STOCKZCGGURL = new string[]{"http://vol.stock.hexun.com/Now/Share/InContinuity.aspx?rank=3","http://vol.stock.hexun.com/Now/Share/OutContinuity.aspx?rank=3"};
    }
    class Hangyefund
    {

        private int rank;
        private string hangye;
        private string url;
        private string atype;
        private int hasstocks;
        private double sumfund;
        private double infund;
        private double percent;
        private DateTime statdate;
        public DateTime Statdate
        {
            get {return statdate; }
            set { this.statdate = value; }
        }
        public int Rank
        {
            set { this.rank = value; }
            get { return this.rank; }
        }
        public string Hangye
        {
            set { this.hangye = value; }
            get { return this.hangye; }
        }
        public string aTpye
        {
            set { this.atype = value; }
            get { return this.atype; }
        }
        public string Url
        {
            set { this.url = value; }
            get { return this.url; }
        }
        public int Hasstocks
        {
            set { this.hasstocks = value; }
            get { return this.hasstocks; }
        }
        public double Sumfund
        {
            set { this.sumfund = value; }
            get { return this.sumfund; }
        }
        public double Infund
        {
            set { this.infund = value; }
            get { return this.infund; }
        }
        public double Percent
        {
            set { this.percent = value; }
            get { return this.percent; }
        }
        public override string ToString()
        {
            return "rank:" + this.rank +
                "\nhangye:" + this.hangye +
                "\nurl:" + this.url +
                "\nsumfund:" + this.sumfund +
                "\ninfund:" + this.infund +
                "\nhasstocks:" + this.hasstocks;
        }
    }
    class Stockinrank
    {
        private int rank;
        private string code;
        private string name;
        private double infund;
        private double percent;
        private string atype;
        public int Rank
        {
            get { return this.rank; }
            set { this.rank = value; }
        }
        public string Code
        {
            get { return this.code; }
            set { this.code = value; }
        }
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }
        public string aType
        {
            get { return this.atype; }
            set { this.atype = value; }
        }
        public double inFund
        {
            get { return this.infund; }
            set { this.infund = value; }
        }
        public double Percent
        {
            get { return this.percent; }
            set { this.percent = value; }
        }


    }
    class Stockzcggok : Stockzcgg
    {
        private DateTime start, end;
        public DateTime Start
        {
            get { return this.start; }
            set { this.start = value; }
        }
        public DateTime End
        {
            get { return this.end; }
            set { this.end = value; }
        }
    }
    class Stockzcgg
    {
        private string code;
        private string name;
        private int days;
        private double fund;
        private double qujianbi;
        private double liutongbi;
        private double swap;
        private double range;
        private string time;
        private DateTime statdate;
        private string atype;
        public DateTime Statdate
        {
            get { return statdate; }
            set { this.statdate = value; }
        }
        public double Fund
        {
            get { return fund; }
            set { this.fund = value; }
        }
        public double Qujb
        {
            get { return qujianbi; }
            set { this.qujianbi = value; }
        }
        public double Liutb
        {
            get { return liutongbi; }
            set { this.liutongbi = value; }
        }
        public double Swap
        {
            get { return swap; }
            set { this.swap = value; }
        }
        public double Range
        {
            get { return range; }
            set { this.range = value; }
        }
        public int Days
        {
            get { return days; }
            set { this.days = value; }
        }
        public string Code
        {
            get { return code; }
            set { this.code = value; }
        }
        public string Name
        {
            get { return name; }
            set { this.name = value; }
        }
        public string Time
        {
            get { return time; }
            set { this.time = value; }
        }
        public string aType
        {
            get { return atype; }
            set { this.atype = value; }
        }

    }
    class Hangye
    {
        private int rank;
        private string hangye;
        private int hasstocks;
        private double sumfund;
        private double infund;
        private double percent;
        private string atype;
        private DateTime statdate;

    }
    struct OkZcgg
    {
        public double range;
        public double liutongbi;
        public double days;
        public double fund;
        public string code;
        public string name;
        public string atype;
        public string chnCode;
    }
    struct Stock
    {
        public string code;
        public string name;
        public string chnCode;
        public override string ToString()
        {
            return "[code:"+ this.code +",name:"+this.name+",chnCode:"+this.chnCode+"]";
        }

    }
    class HexunZcgg
    {
        
        private string code;
        private string name;
        private int days;
        private Double fund;
        private Double qujianbi;
        private Double liutongbi;
        private Double swap;
        private Double range;
        private string time;
        private DateTime statdate;
        private string atype;
        private string url = "http://vol.stock.hexun.com/zcgg.aspx?type=${typei}&page=${page}";
        private string[] atypes = new string[]{"lianxujigouzengcanggegu","lianxujigoujiancanggegu"};
        public string getData()
        {
            for (int ai = 1; ai < atype.Length; ai++)
            {
                for (int page = 1; page < 4; page++)
                {
                }
            }
            return null;
        }

    }
    /**
     * boyi:只有一页
     */
    class HexunBoyi
    {
        private int rank;
        private string code;
        private string name;
        private double price;
        private double range;
        private double big;
        private double small;
        private double scale;
        private DateTime statdate;
        private string atype;
        private string period;
        private string[] periods = new string[] { "day", "week", "month", "season" };
        private string[] atypes = new string[] { "jigoujingliuru", "sanhujingliuru" };
        private string url = "http://vol.stock.hexun.com/affluxBargain.aspx?type=${typei}&param=${parami}";
        public string getData()
        {
            string clazz = "boyi";
            for (int pi = 0; pi < periods.Length; pi++)
            {
                string period = periods[pi];
                for (int ai = 0; ai < atypes.Length; ai++)
                {
                    string atype = atypes[ai];
                    string _url = url.Replace("${typei}", ai.ToString());
                    _url = _url.Replace("${parami}", pi.ToString());
                    //src.Tools.getHtml(_url);
                }
            }
            return clazz;
        }
    }
    class HexunFund
    {
        private string code;
        private string name;
        private double fund;
        private double percent;
        private string atype;
        private string period;
        private DateTime statdate;
        private string[] periods = new string[] {"day","week","month","season"};//param
		private string[] atypes = new string[] {"zijinjingliurupaiming",
			              "zijinjingliuruzhanchengjiaobilipaiming",
			              "zijinjingliuchupaiming",
			              "zijinjingliuchuzhanchengjiaobilipaiming",
			              "jigouzengcanggegupaiming",
			              "jigoujiancanggegupaiming",
			              "sanhuzengcanggegupaiming",
			              "sanhujiancanggegupaiming"};
        private string url = "http://vol.stock.hexun.com/afflux.aspx?type=${typei}&param=${parami}&page=${page}";
        public string getData()
        {
            for (int pi = 1; pi < periods.Length; pi++)
            {
                for (int ai = 1; ai < atypes.Length; ai++)
                {
                    for (int page = 1; page < 4; page++)
                    {
                    }
                }
            }
            return null;
        }

    }
}
